package com.yixq.soa.service.web.auth;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.session.Session;
import org.springframework.session.web.http.HttpSessionStrategy;

/***
 * 提供纯API环境的token会话
 * @author kyler.tang
 *
 */
public class ApiSessionStrategy implements HttpSessionStrategy {
	//这个静态变量会被修改. 注意看启动和配置类
	public static String TOKEN_KEY = "token";
	
	@Override
	public String getRequestedSessionId(HttpServletRequest request) {
		String sessionid = request.getParameter(TOKEN_KEY);

		return sessionid;
	}

	@Override
	public void onNewSession(Session session, HttpServletRequest request, HttpServletResponse response) {

	}

	@Override
	public void onInvalidateSession(HttpServletRequest request, HttpServletResponse response) {

	}

}
